
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "ulog.hpp"


void	test( ULog* ulog_p )
{
	char	buf[ 1024 ];

	for( int i=0; i<1000; i++ ) {
		snprintf( buf, sizeof(buf) - 1, "hello-ERROR-#%8d-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", i );
		ulog_p->error( "ulog.cpp", __FILE__, __LINE__, buf );

		snprintf( buf, sizeof(buf) - 1, "hello-INFO-#%8d-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", i );
		ulog_p->info( "ulog.cpp", __FILE__, __LINE__, buf );

		snprintf( buf, sizeof(buf) - 1, "hello-DEBUG-#%8d-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", i );
		ulog_p->debug( "ulog.cpp", __FILE__, __LINE__, buf );
	}
}


int	main( int argc, char* argv[] )
{
	if ( argc < 3 ) {
		fprintf(stdout, "\tUSAGE : %s <ulog-service-ip> <ulog-service-port>\n", argv[0]);
		return	0;
	}

	const char*	host = argv[1];
	int		port = atoi( argv[2] );

	ULog	ulog( host, port );

	test( &ulog );

	return	0;
}

